## load all the libraries
library(dplyr)
library(ggplot2)
library(babynames)
library(plotly)
library(shiny)
library(rsconnect)
library(readr)
library(medicaldata)
## datasets for this data challenge are:
View(strep_tb)
# clean data with improved patients
strep_imp <- strep_tb %>%
filter(improved == "TRUE") %>%
select(-dose_PAS_g)
# first plot - table
fig1 <- plot_ly(
type = 'table',
header = list(
values = c("<b>Control/Case</b>", "<b>radiologic_6m</b>"),
align = c("center", "center"),
line = list(width = 1, color = 'black'),
fill = list(color = c("grey", "grey")),
font = list(family = "Arial", size = 14, color = "white")
),
cells = list(
values = rbind(
t(as.matrix(unname(strep_imp$arm))),
c(as.matrix(unname(strep_imp$radiologic_6m)))
),
align = c("center", "center"),
line = list(color = "black", width = 1),
font = list(family = "Arial", size = 12, color = c("black"))
))
# second plot - bar chart
p <- ggplot(data = strep_imp,
aes(x= radiologic_6m, fill = arm)) +
geom_bar()
fig2 <- ggplotly(p, dynamicTicks = TRUE)
# combine 2 graphs together
fig <- subplot(fig1, fig2) %>%
layout(title = 'Side By Side Subplots')
## Warning: Can only have one: config
fig
## Warning: 'layout' objects don't have these attributes: 'NA'
## Valid attributes include:
## '_deprecated', 'activeshape', 'annotations', 'autosize', 'autotypenumbers', 'calendar', 'clickmode', 'coloraxis', 'colorscale', 'colorway', 'computed', 'datarevision', 'dragmode', 'editrevision', 'editType', 'font', 'geo', 'grid', 'height', 'hidesources', 'hoverdistance', 'hoverlabel', 'hovermode', 'images', 'legend', 'mapbox', 'margin', 'meta', 'metasrc', 'modebar', 'newshape', 'paper_bgcolor', 'plot_bgcolor', 'polar', 'scene', 'selectdirection', 'selectionrevision', 'separators', 'shapes', 'showlegend', 'sliders', 'spikedistance', 'template', 'ternary', 'title', 'transition', 'uirevision', 'uniformtext', 'updatemenus', 'width', 'xaxis', 'yaxis', 'barmode', 'bargap', 'mapType'